import { Component, OnInit, ViewChild } from '@angular/core';
import { _HttpClient, ModalHelper } from '@delon/theme';
import { STColumn, STComponent } from '@delon/abc/table';
import { SFSchema, SFComponent } from '@delon/form';
import { HttpService, SupDic, GridComponent } from 'lbf';
import { NzMessageService } from 'ng-zorro-antd';

@Component({
  selector: 'app-dzda-clcjxx',
  templateUrl: './clcjxx.component.html',
  styleUrls: ['./clcjxx.component.less']
})
export class DzdaClcjxxComponent implements OnInit {

  wjparam = {snames: {query: 'dzda_clcjstcx'},param: {}}

  isVisible = false;
  params = {sname: 'dzda_clcjxxcx',queryparas: {}}
  searchSchema: SFSchema = {
    properties: {
      DAD017: {
        type: 'number',
        title: '事项编码',
        enum: this.supdic.getSFDic('DAD017'),
        ui: {
          widget: 'select',
          allowClear: true,
          width: 350
        }
      },
      // DAD028: {
      //   type: 'number',
      //   title: '材料ID',
      //   enum: this.supdic.getSFDic('DAD028'),
      //   ui: {
      //     widget: 'select',
      //     allowClear: true,
      //     width: 200
      //   }
      // },
      CAC045: {
        type: 'string',
        title: '是否通过',
        enum: this.supdic.getSFDic('CAC045'),
        ui: {
          widget: 'select',
          allowClear: true,
          width: 200
        }
      }
    }
  };

  columns: STColumn[] = [
    { title: '事项编码',  index: 'DAD017',dic: 'DAD017'},
    { title: '材料ID',index: 'DAD028'},
    { title: '受理对象',index: 'DAD036',dic: 'DAD036'},
    { title: '证件号码',index: 'DAD070'},
    { title: '是否通过',index: 'CAC045',dic: 'CAC045'},
    { title: '收件份数',index: 'CZE010'},
    { title: '收件人',index: 'AAE011'},
    { title: '收件时间',index: 'AAE036'},
    { title: '资料类型',index: 'DAD161',format: ()=> '材料'},
    {
      title: '操作区',
      buttons: [
        { text: '详情', click: (item: any) => this.show(item)}
      ]
    }
  ];

  @ViewChild('sf',{static: false}) sf: SFComponent;
  @ViewChild('xqsf',{static: false}) xqsf: SFComponent;
  @ViewChild('st',{static: false}) st: GridComponent;
  constructor(private httpservice: HttpService,
    private supdic: SupDic,
    private msgSrv: NzMessageService) { }

  ngOnInit() { }

  show(item){
    this.wjparam.param = {CZE001: item.CZE001}

    setTimeout(() => {
      this.isVisible = true;
    }, 1000);
  }

  handleCancel(){
    this.isVisible = false;
  }

  query(){
    this.st.pi = 1
    this.st.reload(this.sf.value)
  }

}
